<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let arr = [1, , 3, 4, 5]
    let res = arr.some(function (item) {
      return item > 2
    })
    console.log(res);
    Array.prototype.some2 = function (callback, thisArg) {
      if (this === null) {
        throw new TypeError('this is null')
      }
      if (typeof callback !== 'function') {
        throw new TypeError('callback is not a function')
      }
      // for (let i = 0; i < this.length; i++) {
      //   if (callback.call(thisArg, this[i], i, this)) {
      //     return true
      //   }
      // }
      // return false
      for (let i = 0; i < this.length; i++) {
        if (callback.call(thisArg, this[i], i, this)) {
          return true
        }
      }
      return false
    }
    res = arr.some(function (item) {
      return item > 2
    })
    console.log(res);
  </script>
</body>

</html>